package Day23.日期相关类;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author hyhWTX
 * @version 1.0
 * @date 2022年04月10日 12:16
 */


public class DateDemo2 {
    public static void main(String[] args) throws ParseException {
        Date nowTime = new Date();
        Date otherTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2026-10-10 20:20:20");
        //检测nowTime是否在otherTime之后
        System.out.println(nowTime.after(otherTime));
        //检测nowTime是否在otherTime之前
        System.out.println(nowTime.before(otherTime));
        System.out.println(nowTime.getYear());
    }
}
